import {
  SystemMenu,
  SystemMenuQuery,
  SystemMenuDelete,
  SystemMenuIsShowMenu,
  SystemMenuHaveMenuPermission,
  SystemMenuHaveDataPermission,
  SystemMenuHaveButtonPermission,
  SystemMenuIsFreeze,
  SystemMenuIsShowMobile,
} from "@/services/api";
import { request, METHOD } from "@/utils/request";

/**
 * 树
 */
export function menuQuery(menuId = null, isAgileMenu = null) {
  var url = SystemMenu;
  if (menuId) {
    url += "?menuId=" + menuId + "&isAgileMenu=" + isAgileMenu;
  }
  return request(url, METHOD.GET, {});
}

/**
 * 列表
 */
export function query(param) {
  return request(SystemMenuQuery, METHOD.POST, param);
}

/**
 * 删除
 */
export async function del(param) {
  return request(SystemMenuDelete, METHOD.POST, param);
}
/**
 * 根据Id获取
 */
export function findById(param) {
  return request(SystemMenuFindById, METHOD.GET, param);
}
/**
 *
 */
export function isShowMenu(param) {
  return request(SystemMenuIsShowMenu, METHOD.POST, param);
}
/**
 *
 */
export function haveMenuPermission(param) {
  return request(SystemMenuHaveMenuPermission, METHOD.POST, param);
}
/**
 *
 */
export function haveDataPermission(param) {
  return request(SystemMenuHaveDataPermission, METHOD.POST, param);
}

/**
 *
 */
export function haveButtonPermission(param) {
  return request(SystemMenuHaveButtonPermission, METHOD.POST, param);
}
/**
 *
 */
export function isFreeze(param) {
  return request(SystemMenuIsFreeze, METHOD.POST, param);
}

/**
 *
 */
export function isShowMobile(param) {
  return request(SystemMenuIsShowMobile, METHOD.POST, param);
}
export default {
  menuQuery,
  query,
  del,
  isShowMenu,
  haveMenuPermission,
  haveDataPermission,
  haveButtonPermission,
  isFreeze,
  isShowMobile,
};
